<template>
	<view>
		<!-- 弹出层 -->
		<view class="content">
			<!-- 做黑色阴影颜色 -->
			<view class="uni-mask" v-if="bannerShow" @tap="create"></view>
			<view class="list">
				<view class="rowList" @tap="upfile">
					<view class="title">头像</view>
					<view class="right"><view class="tis">
					<image :src="uson.imgNow" mode="widthFix"></image>
					</view><view class="icon jiantou"></view></view>
				</view>
				<view class="rowList">
					<view class="title">昵称</view>
					<view class="right"><view class="tis">{{uson.uname}}</view>
					<view class="icon"></view></view>
				</view>
				<view class="rowList">
					<view class="title">性别</view>
					<view class="right"><view class="tis">{{uson.genderName}}</view>
					<view class="icon"></view></view>
				</view>
				<view class="rowList">
					<view class="title">电话号码</view>
					<view class="right"><view class="tis">{{uson.utel}}</view>
					<view class="icon"></view></view>
				</view>
				<view class="rowList">
					<view class="title">个性签名</view>
					<view class="right"><view class="tis">{{uson.utext}}</view>
					<view class="icon"></view></view>
				</view>
				<view class="rowList" @tap="toAddress">
					<view class="title">收货地址</view>
					<view class="right"><view class="tis">{{uson.address.detailed}}</view>
					<view class="icon jiantou"></view></view>
				</view>
<!-- 				<view class="rowList">
					<view class="title">账户安全</view>
					<view class="right"><view class="tis"></view><view class="icon jiantou"></view></view>
				</view> -->
			</view>
			<!-- <view class="list">
				<view class="rowList">
					<view class="title">通知提醒</view>
					<view class="right"><view class="tis"></view><view class="icon jiantou"></view></view>
				</view>
				<view class="rowList">
					<view class="title">支付设置</view>
					<view class="right"><view class="tis"></view><view class="icon jiantou"></view></view>
				</view>
				<view class="rowList">
					<view class="title">通用</view>
					<view class="right"><view class="tis"></view><view class="icon jiantou"></view></view>
				</view>
			</view> -->
			<view class="list">
				<view class="rowList">
					<view class="title">版本升级</view>
					<view class="right"><view class="tis">{{Vnumber}}</view><view class="icon jiantou"></view></view>
				</view>
				<view class="rowList">
					<view class="title">清除缓存</view>
					<view class="right"><view class="tis"></view><view class="icon jiantou"></view></view>
				</view>
<!-- 				<view class="rowList">
					<view class="title">问题反馈</view>
					<view class="right"><view class="tis"></view><view class="icon jiantou"></view></view>
				</view>
				<view class="rowList">
					<view class="title">关于商城</view>
					<view class="right"><view class="tis"></view><view class="icon jiantou"></view></view>
				</view> -->
			</view>
			<view class="list">
				<view class="rowList" @tap="update">
					<view class="title" style="color: #3E8BC7;">修改个人信息</view>
					<view class="right"><view class="tis"></view><view class="icon jiantou"></view></view>
				</view>
			</view>
			<view class="tianchong"></view>
		</view>
		<!-- 底部弹框 -->
		<update ref="update"></update>
	</view>
</template>

<script>
	import update from './update/update.vue'
	export default {
		components: {
		     update
		},
		data() {
			return {
				//接口地址
				baseURL:'',
				//个人信息
				uson:{
					imgNow: '/static/img/face.jpg',//头像
					uname:'大黑哥',//姓名
					genderName:'女',
					gender:0,//性别
					utel:'17683864164',//电话号码
					utext:'这个人非常懒，什么都不写',//个人签名
					address:{
						region:{
							"label":"广东省-深圳市-福田区",
							"value":[18,2,1],
							"cityCode":"440304",
						},
						detailed:'深南大道1111号无名摩登大厦6楼A2',
					}//收货地址
				},
				Vnumber:'v1.0.0',
				bannerShow: false
			};
		},
		onLoad(option) {
			this.uson.uname = option.username;
			if(option.face.indexOf("http") >= 0){
				this.uson.imgNow = option.face;
			}else{
				this.uson.imgNow = '../' + option.face;
			}
			this.uson.gender = option.gender;
			if(option.gender == 1){
				this.uson.genderName = '男';
			}else{
				this.uson.genderName = '女';
			}
		},
		methods: {
			//上传图片
			upfile(){
				let _this = this;
				uni.chooseImage({ // 从本地相册选择图片或使用相机拍照。
					count: 1,//默认选择1张图片
					sizeType: ['original', 'compressed'],//original 原图，compressed 压缩图，默认二者都有
					success:  (res)=> {
						console.log(res.tempFilePaths[0]);//成功则返回图片的本地文件路径列表 tempFilePaths
						uni.uploadFile({//将本地资源上传到开发者服务器
							url:baseURL+'/api/Common/upload', //接口地址
							filePath: res.tempFilePaths[0],//图片地址
							name: 'file',
							formData:{
								access_token:uni.getStorageSync('access_token'),//加入token
							},
							success: (uploadFileRes) => {
								let data = JSON.parse(uploadFileRes.data)
								if(data.code ==1){
									this.my_avatar = data.data.url;//上传成功后返回的图片地址
								}
							}
						});
					}
				});
			},

			// 修改个人信息弹窗
			update(){
				this.$refs.update.show(
				this.uson.uname,
				this.uson.gender,
				this.uson.utel,
				this.uson.utext);
				this.bannerShow = true;
			},
			create(){
				this.$refs.update.cancel();
				this.bannerShow = false;
			},
			showType(tbIndex){
				this.tabbarIndex = tbIndex;
				this.list = this.orderList[tbIndex];
			},
			toAddress(){
				uni.navigateTo({
					url:'../address/address'
				})
			}
		}
	}
</script>

<style lang="scss">
page{
	background-color: #f3f3f3;	
}
@font-face {
	font-family: 'HMfont-home';
	src: url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAKQAAsAAAAABjwAAAJFAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCCcApIXAE2AiQDCAsGAAQgBYRtBy4bgAUR1Ys/sq+wcQ0AKCMxzO7s4dbxlywA4w2+QAIrUAAAAABA8Hzt9zt3d9//+00Taomhi1gSkUZTzUynEiJMh45HsUimByZ4/unc4gMVRqR1SoYZi0pw3aFbm/4hO4VNh2bJ2umnZ+Q3hAuhQ3jVPHGMDgCfuHf6W0CBzAeU4160xqAuoC4OpEDHGhRZCWXcMHaBSzgOAbykUYLUXFp6sBiscQLIvJsaweacGAyLWARXzVKDnCsHqw6SWzgLvy/fpWJB4WisnI7J2nEq3tgxrP/X+31CuUBAqx1AAyWAAempDbahEUbXeIOGLNhXpsCb9w3IXrUI++usdD8AKZB3T3x3LAKAAritnkSA5KjrQSJz++JfybXOMS/f0eF7B4itVLl1SnvltSIO9qACqdWN/RMBBLqPPHZo3Z8lA8D9FYUS09MNdg8mgT/BR01GF1p6ZVR+bbsicoYKL17gH1ujvI5VJU4bFSyJEWY3qSk0lhySoZXAwUcZXFjK4aWY+tU+YqyiEeMBitgBEMJcQRHkGpowdyRDe4FDkl+4CIuGlz5xSx95YrnZkbESbKH+gWuo145RZlHmDc0UK84KQ8YLeXQeKNK8GLlijzzHjPFtShENmqmDCzgNYyQYmDw2klqR4ZBluu5NaUOdmlHNWAm2UP/ANdRrv7PMSp+/oZlixS0NNe4X8uj6hyLNe5Cusr5Xw728Mr5NKaJBM3VwAYMwRoKhfpDHRlI7wj8cMruV7itL11d0X7cLpWZY6kTsQo1Zo6lQCgA=')
		format('woff2');
}
.icon {
	font-family: 'HMfont-home' !important;
	font-size: 35upx;
	font-style: normal;
	color: #000000;
	&.jiantou {
		&:before {
			content: '\e627';
		}
	}
}

.content{
	position: relative;
	padding-bottom: 100%;
	.uni-mask{
		position: absolute;
		z-index: 1;
		min-width: 100%;
		min-height: 100%;
		background: rgba(0, 0, 0, 0.6);
	}
	.list{
		width: 96%;
		padding-left: 4%;
		background-color: #fff;
		margin-bottom: 20upx;
		.rowList{
			widows: 100%;
			min-height: 100upx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			border-bottom: solid 1upx #eee;
			&:last-child{
				border-bottom: none;
			}
			.title{
				font-size: 32upx;
				color: #333;
			}
			.right{
				display: flex;
				align-items: center;
				color: #999;
				.tis{
					font-size: 26upx;
					margin-right: 5upx;
					max-height: 120upx;
					image{
						width: 100upx;
						height: 100upx;
						border-radius: 100%;
						margin: 10upx 0;
					}
				}
				.icon{
					width: 40upx;
					color: #cecece;
				}
			}
			
		}
	}
}

</style>
